import {fabric} from "fabric";
import {useEffect} from "react";
import Car from '../assets/car.png'
export default function FabricDemo() {

    const init = () => {
        const canvas = new fabric.Canvas('canvas', {isDrawingMode: true})
        // const rect = new fabric.Rect({
        //     top: 30,
        //     left: 30,
        //     width: 100,
        //     height: 60,
        //     fill: 'red'
        // })
        // canvas.add(rect)

        // canvas.setBackgroundImage(Car, canvas.renderAll.bind(canvas), {opacity: 0.1})
        // const text = new fabric.Textbox('你好啊')
        // canvas.add(text)
    }

    useEffect(() => {
        init()
    }, [])

    return (
        <canvas width={400} height={400} id="canvas" style={{border: '1px solid black'}}></canvas>
    )
}